#include "openslaudioimpl.h"
#include "opensles.h"
OpenSLAudioImpl::OpenSLAudioImpl()
{
    m_oOpenSLES = new OpenSLES;
}

OpenSLAudioImpl::~OpenSLAudioImpl()
{
    if(m_oOpenSLES)
        delete m_oOpenSLES;
}

bool OpenSLAudioImpl::Start(int sampels, int channel, int bitsize)
{
    if(m_oOpenSLES)
    {
        m_oOpenSLES->CreateEngine();
        m_oOpenSLES->CreateBufferQueueAudioPlayer(sampels,channel,bitsize);
        m_oOpenSLES->Start();
    }
}

bool OpenSLAudioImpl::Stop()
{
    if(m_oOpenSLES)
    {
        m_oOpenSLES->Stop();
        m_oOpenSLES->Destroy();
    }
}

void OpenSLAudioImpl::Init(IAudioData *impl)
{
    if(m_oOpenSLES)
        m_oOpenSLES->Init(impl);
}

